import { stopTransform, transfrom } from "./action/newTransfrom.js";

//生成二叉树算法
// import "./test.js";
import { on, scoket } from "./utils/scoket.js";
import "./role.js";
import "./init.js";
export let currentState = { role: "" };

type Dom<T> = (str: string) => T;

export const domg: Dom<HTMLElement> = (str: string) =>
  document.querySelector(str) as HTMLElement;

export const app = document.querySelector("#app") as HTMLDivElement;
export const role = document.querySelector(".role1") as HTMLDivElement;

let p = localStorage.role || "";

export const role1 = document.querySelector(".role1") as HTMLDivElement;

export const role2 = document.querySelector(".role2") as HTMLDivElement;

export const currentRole = document.querySelector(
  ".role" + p.slice(1)
) as HTMLDivElement;

export const boxW = app.offsetWidth - role.offsetWidth - 6;
export const boxH = app.offsetHeight - role.offsetHeight - 6;

export const roleH = role.offsetHeight;
export const roleW = role.offsetWidth;

window.addEventListener("keydown", transfrom);

window.addEventListener("keyup", stopTransform);

window.addEventListener("beforeunload", () => {});
